using System.Collections;
using UnityEngine;

public class TRIG_PLAYCHATBOX : MonoBehaviour
{
	[Header("WARNING! This can only run once!")]
	public INT_Chat Chat;

	public float TriggerDelay;

	public bool ChatHasRan;

	public bool DestroyOnCollide;

	private void OnTriggerEnter2D(Collider2D other)
	{
		if (Object.op_Implicit((Object)(object)((Component)other).GetComponent<PlayerManager>()) && !ChatHasRan)
		{
			ChatHasRan = true;
			((MonoBehaviour)this).StartCoroutine(Delay());
		}
	}

	private IEnumerator Delay()
	{
		yield return (object)new WaitForSeconds(TriggerDelay);
		Chat.RUN();
		if (DestroyOnCollide)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
